home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 May: Tool Chest / Dev.CD May 97 TC.toast / Sample Code / Overview / TESample / TCTESampleGlue.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-18  |  2.8 KB  |  89 lines  |  [TEXT/MPS ]

  1. /*
  2. *    Apple Macintosh Developer Technical Support
  3. *
  4. *    MultiFinder-Aware TextEdit Sample Application
  5. *
  6. *    TESample
  7. *
  8. *    TCTESampleGlue.a    -    THINK C Assembler Source
  9. *
  10. *    Copyright © 1989 Apple Computer, Inc.
  11. *    All rights reserved.
  12. *
  13. *    Versions:
  14. *                1.00                08/88
  15. *                1.01                11/88
  16. *                1.02                04/89
  17. *                1.03                06/89
  18. *                1.04                06/92
  19. *
  20. *    Components:
  21. *                TESample.p            June 1, 1989
  22. *                TESample.c            June 1, 1989
  23. *                TESampleInit.c        June 4, 1992
  24. *                TESampleGlue.a        June 1, 1989
  25. *                TESample.r            June 1, 1989
  26. *                TESample.h            June 1, 1989
  27. *                PTESample.make        June 1, 1989
  28. *                CTESample.make        June 1, 1989
  29. *                TCTESample.π        June 4, 1992
  30. *                TCTESample.π.rsrc    June 4, 1992
  31. *                TCTESampleGlue.c    June 4, 1992
  32. *
  33. *    TESample is an example application that demonstrates how 
  34. *    to initialize the commonly used toolbox managers, operate 
  35. *    successfully under MultiFinder, handle desk accessories and 
  36. *    create, grow, and zoom windows. The fundamental TextEdit 
  37. *    toolbox calls and TextEdit autoscroll are demonstrated. It 
  38. *    also shows how to create and maintain scrollbar controls.
  39. *
  40. *    It does not by any means demonstrate all the techniques you 
  41. *    need for a large application. In particular, Sample does not 
  42. *    cover exception handling, multiple windows/documents, 
  43. *    sophisticated memory management, printing, or undo. All of 
  44. *    these are vital parts of a normal full-sized application.
  45. *
  46. *    This application is an example of the form of a Macintosh 
  47. *    application; it is NOT a template. It is NOT intended to be 
  48. *    used as a foundation for the next world-class, best-selling, 
  49. *    600K application. A stick figure drawing of the human body may 
  50. *    be a good example of the form for a painting, but that does not 
  51. *    mean it should be used as the basis for the next Mona Lisa.
  52. *
  53. *    We recommend that you review this program or Sample before 
  54. *    beginning a new application. Sample is a simple app. which doesn’t 
  55. *    use TextEdit or the Control Manager.
  56. *
  57.  
  58. *
  59. *    AsmClickLoop
  60. *
  61. *    This routine gets called by the TextEdit Manager from TEClick.
  62. *    It calls the old, default click loop routine that scrolls the
  63. *    text, and then calls our own Pascal routine that handles
  64. *    tracking the scroll bars to follow along.  It doesn't bother
  65. *    with saving registers A0 and D0, because they are trashed
  66. *    anyway by TextEdit.
  67. */
  68.  
  69. #include "TESample.h"
  70.  
  71. void AsmClickLoop()
  72. {
  73.     asm {            
  74.             MOVEM.L        D1-D2/A1,-(SP)        ; D0 and A0 need not be saved
  75.             CLR.L        -(SP)                ; make space for procedure pointer
  76.             JSR            GetOldClickLoop        ; get the old clickLoop
  77.             MOVEA.L        (SP)+,A0            ; into A0
  78.             MOVEM.L        (SP)+,D1-D2/A1        ; restore the world as it was
  79.             
  80.             JSR            (A0)                ; and execute old clickLoop
  81.  
  82.             MOVEM.L        D1-D2/A1,-(SP)        ; D0 and A0 need not be saved
  83.             JSR            PascalClickLoop        ; do our clickLoop
  84.             MOVEM.L        (SP)+,D1-D2/A1        ; restore the world as it was
  85.             MOVEQ        #1,D0                ; clear the zero flag so TextEdit keeps going
  86.             RTS
  87.     }
  88. }
  89.